//
//  SEGSharedTopicDetailModel.m
//  ExcellentHome
//
//  Created by 揭婧雯 on 2017/10/18.
//  Copyright © 2017年 陈区. All rights reserved.
//

#import "SEGSharedTopicDetailModel.h"

@implementation SEGSharedTopicDetailModel
- (instancetype)initWithDictionary:(NSDictionary*)dictionary
{
    self = [super init];
    if (self) {
        _model = [[SEGSharedTopicDetailInfoModel alloc] init];
        _hotTopic = [NSArray array];
        [self setValuesForKeysWithDictionary:dictionary];
    }
    return self;
}
+ (instancetype)initWithDictionary:(NSDictionary*)dictionary
{
    return [[self alloc] initWithDictionary:dictionary];
}
- (void)setValue:(id)value forUndefinedKey:(NSString*)key
{}

- (void)setModel:(NSDictionary *)model{
    if ([model isKindOfClass:[NSDictionary class]]) {
        _model = [SEGSharedTopicDetailInfoModel initWithDictionary:model];
    }
}
- (void)setHotTopic:(NSArray *)hotTopic{
    NSMutableArray *arrM = [NSMutableArray array];
    [hotTopic enumerateObjectsUsingBlock:^(NSDictionary* obj, NSUInteger idx, BOOL* _Nonnull stop) {
        if ([obj isKindOfClass:[NSDictionary class]]) {
            [arrM addObject:[SEGSharedHotTopicModel initWithDictionary:obj]];
        }
    }];
    _hotTopic = [arrM copy];
}

//- (void)setValue:(id)value forKey:(NSString*)key
//{
//    if ([key isEqualToString:@"user"]) {
//        if ([value isKindOfClass:[NSDictionary class]]) {
//            _user = [SEGSharedCommonUserModel initWithDictionary:value];
//        }
//        return;
//    }
//
//    if ([key isEqualToString:@"comment"]) {
//        if ([value isKindOfClass:[NSArray class]]) {
//            NSMutableArray* _arrM = [NSMutableArray array];
//            for (NSDictionary* dict in value) {
//                SEGSharedNeihborhoodCommentModel* model = [SEGSharedNeihborhoodCommentModel initWithDictionary:dict];
//                [_arrM addObject:model];
//            }
//            _comment = _arrM.copy;
//        }
//        return;
//    }
//
//    if ([key isEqualToString:@"model"]) {
//        if ([value isKindOfClass:[NSDictionary class]]) {
//            _model = [SEGSharedNeihborhoodInfoModel initWithDictionary:value];
//        }
//        return;
//    }
//
//    [super setValue:value forKey:key];
//}
@end
